import axios from 'axios'
// import Cookie from 'js-cookie'
// import { ACCESS_TOKEN } from '@/store/mutation-types'

// 创建 axios 实例
const Axios = axios.create({
  // API 请求的默认前缀
  // baseURL: '/api',
  baseURL: 'http://10.22.30.33:8080',
  timeout: 1000 // 请求超时时间
})

// request interceptor
// Axios.interceptors.request.use(config => {
  // const token = localStorage.getItem('access_token')
//   const token = Cookie.get('access_token')
  // config.headers['Content-Type'] = 'application/json;charset=UTF-8'
//   if (token) {
//     config.headers['Authorization'] = token
//   }
  // return config
// })

// response interceptor
Axios.interceptors.response.use((response) => {
  response.headers['Content-Type'] = 'application/json;charset=UTF-8'
  return response.data
})

export default Axios
